const fs = require('fs');
const path = require('path');
const compress = require('./utils/compress.js')


const arguments = process.argv.slice(2)

if (fs.existsSync('dist') === false) {
    fs.mkdirSync('dist', { recursive: true })
}


console.log('arguments',arguments)
if (arguments.length < 1) {
    console.log('请输入插件名称')
    process.exit(1)
} else if (arguments.length === 1 && arguments[0] === '--plugins') {
    //  打包packages下面除了base以外的所有文件夹
    const pluginNames = fs.readdirSync('packages').filter(name => name!== 'base')
    console.log(pluginNames)
    pluginNames.forEach(name => {
        compress(name)
    })
} else if (arguments.length > 1 && arguments[0] === '--plugins') {
    // 打包packages下面的指定文件夹
    const pluginNames = arguments.slice(1)
    console.log(pluginNames)
    pluginNames.forEach(name => {
        compress(name)
    })
} else {


}
